#include<bits/stdc++.h>
using namespace std;
int n,ans=0,cnt[100010],r[100010],l=-1,s=0;
bool cmp1(int x,int y){
	return x<y;
}
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&r[i]);
		cnt[r[i]]++;
	}
	sort(r+1,r+1+n,cmp1);
	for(int i=1;i<=n;i++){
		if(r[i]==l)continue;
		l=r[i];
		if(s>=cnt[r[i]]){
			ans+=cnt[r[i]];
		}
		else{
			ans+=s;
			s=cnt[r[i]];
		}
	}
	printf("%d\n",n-ans);
	return 0;
}
